package com.tank.dubbo.service.consumer;

import com.tank.dubbo.service.DemoService;
import com.tank.dubbo.service.DemoService2;
import org.springframework.context.support.AbstractRefreshableConfigApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;

import static java.lang.Thread.currentThread;

/**
 * Created with IntelliJ IDEA.
 * User: SuQiEr
 * Date:2017/9/28
 * Time: 18:38
 * To change this template use File | Settings | File Templates.
 */
public class Consumer {

    public static void main(String[] args) throws Exception {
        AbstractRefreshableConfigApplicationContext context =
                new FileSystemXmlApplicationContext("E:\\workspace\\tank\\quiet-beauty\\quiet-jdk8\\src\\main\\java\\com\\tank\\dubbo\\service\\consumer\\applicationContext-aop.xml");
        context.start();

        System.out.println("..........................获取spring..........................");
        DemoService demoService = (DemoService) context.getBean("demoService"); // obtain proxy object for remote invocation
       // DemoService2 demoService2 = (DemoService2)context.getBean("demoService2");
        System.out.println("superclass:"+demoService.getClass().getSuperclass().getName());
        System.out.println("..........................DubboInvoker调用....................");
        String hello = demoService.sayHello("world"); // execute remote invocation
        System.out.println("..........................结束....................");
        System.out.println(hello); // show the result
    }

}
